package com.rongdu.workflow.rule;

import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

import com.rongdu.workflow.matcher.Matcher;

/**
 * 检查字符串是否是包括角色信息
 * 
 * @author Administrator
 *
 */
public class RoleMatcher implements Matcher {
	private String prefix;

	public RoleMatcher(String prefix) {
		if (StringUtils.isEmpty(prefix)) {
			throw new IllegalArgumentException("prefix不能为空");
		}
		this.prefix = prefix;
	}

	@Override
	public boolean matches(String text) {
		Assert.notNull(text);

		if (text.contains(prefix)) {
			return true;
		}
		return false;
	}

}
